/*
接口统一管理配置
*/
import config from '@/common/environment.js';
const  BASE_API=config.BASE_API;
const  multipartUrl=config.MULTIPART_API;
const  fileSaveTarget=config.FILE_SAVE_TARGET; 
const install = (Vue, vm) => {
	// 将各个定义的接口名称，统一放进对象挂载到vm.$u.api(因为vm就是this，也即this.$u.api)下
	const sys={
		login: (params = {}) => vm.$u.post(BASE_API+'sys/login', params),
		loginByToken: (params = {}) => vm.$u.post(BASE_API+'sys/startByToken',params),
		getAppConfig: (params = {}) => vm.$u.post(BASE_API+'sys/getAppConfig', params),
		checkLoginStatus: (params = {}) => vm.$u.post(BASE_API+'sys/checkLoginStatus', params),
		loginOut :  (params = {}) => vm.$u.post(BASE_API+'sys/logout', params),
		checkMobile:  (params = {}) => vm.$u.post(BASE_API+'sys/checkMobile', params),
		register: (params = {}) => vm.$u.post(BASE_API+'sys/register', params),
		getLatestVersion: (params = {}) => vm.$u.post(BASE_API+'sys/getLatestVersion', params),
	}
	const imUser={
		checkUserPower: (params = {}) => vm.$u.post(BASE_API+'imUserPower/checkUserPower', params),
		updateUserPower: (params = {}) => vm.$u.post(BASE_API+'imUserPower/updateUserPower', params),
		getMyFriendList:(params = {}) => vm.$u.post(BASE_API+'imUserFriend/getMyFriendList', params),
		getUserAccountInfo: (params = {}) => vm.$u.post(BASE_API+'imUser/getUserAccountInfo', params),
		toPayUserBalance:(params = {}) => vm.$u.post(BASE_API+'imUser/toPayUserBalance', params),
		updateUserInfo: (params = {}) => vm.$u.post(BASE_API+'imUser/updateUserInfo', params),
		searchUser: (params = {}) => vm.$u.post(BASE_API+'imUser/searchUser', params),
		syncContacts:(params = {}) => vm.$u.post(BASE_API+'imUser/syncContacts', params),
		addFriend:(params = {}) => vm.$u.post(BASE_API+'imUserFriend/addFriend', params),
		deleteFriend:(params = {}) => vm.$u.post(BASE_API+'imUserFriend/deleteFriend', params),
		updateFriendInfo:(params = {}) => vm.$u.post(BASE_API+'imUserFriend/updateFriendInfo', params),
		checkFriendApply:(params = {}) => vm.$u.post(BASE_API+'imUserFriend/checkFriendApply', params),
		unHandleFriendApply:(params = {}) => vm.$u.post(BASE_API+'imUserFriend/unHandleFriendApply', params),
		handleFriendApply:(params = {}) => vm.$u.post(BASE_API+'imUserFriend/handleFriendApply', params),
		blackFriend:(params = {}) => vm.$u.post(BASE_API+'imUserFriend/blackFriend', params),
		getFriendInfo:(params = {}) => vm.$u.post(BASE_API+'imUserFriend/getFriendInfo', params),
		getNewFriendInfo:(params = {}) => vm.$u.post(BASE_API+'imUserFriend/getNewFriendInfo', params),
		getMyFriendListForAdd:(params = {}) => vm.$u.post(BASE_API+'imUserFriend/getMyFriendListForAdd', params),
		getMyFriendListForDel:(params = {}) => vm.$u.post(BASE_API+'imUserFriend/getMyFriendListForDel', params),
		getGroupMemberInfo:(params = {}) => vm.$u.post(BASE_API+'imUser/getGroupMemberInfo', params),
		getVideoCallingInfo: (params = {}) => vm.$u.post(BASE_API+'imUser/getVideoCallingInfo', params),
		//扫码加入群聊
		scanQRJoinGroup:(params = {}) => vm.$u.post(BASE_API+'imUser/scanQRJoinGroup',params),
		//账户交易记录
		addUserAccountRecord:(params = {}) => vm.$u.post(BASE_API+'accountRecord/addUserAccountRecord',params),
		getUserAccountRecordList:(params = {}) => vm.$u.post(BASE_API+'accountRecord/getUserAccountRecordList',params),
		updateUserAccountRecord:(params = {}) => vm.$u.post(BASE_API+'accountRecord/updateUserAccountRecord',params),
		deleteUserAccountRecord:(params = {}) => vm.$u.post(BASE_API+'accountRecord/deleteUserAccountRecord',params),
		//发红包时校验
		validateTradePwd: (params = {}) => vm.$u.post(BASE_API+'imUser/validateTradePwd', params),
		//充值时校验
		validatePayTradePwd: (params = {}) => vm.$u.post(BASE_API+'imUser/validatePayTradePwd', params),
		//修改支付密码
		updateTradePwd:(params = {}) => vm.$u.post(BASE_API+'imUser/updateTradePwd',params),
		//修改登录密码
		updateUserPassword:(params = {}) => vm.$u.post(BASE_API+'imUser/updateUserPassword',params),
	}

	const chatGroup={
		//获取我的群聊列表
		getMyChatGroupList: (params = {}) => vm.$u.post(BASE_API+'imChatGroup/getMyChatGroupList', params),
		//获取我的加入群聊列表
		getMyJoinChatGroupList: (params = {}) => vm.$u.post(BASE_API+'imChatGroup/getMyJoinChatGroupList', params),
		//获取群聊信息
		getChatGroupInfo: (params = {}) => vm.$u.post(BASE_API+'imChatGroup/getChatGroupInfo', params),
		//获取群成员
		getChatGroupMembers:(params = {}) => vm.$u.post(BASE_API+'imChatGroup/getChatGroupMembers', params),
		//发起点对点聊天
		createSingleChat: (params = {}) => vm.$u.post(BASE_API+'imChatGroup/createSingleChat', params),
		//发起群聊
		launchChatGroup: (params = {}) => vm.$u.post(BASE_API+'imChatGroup/launchChatGroup', params),
		//更新我的群聊设置
		updateGroupInfo: (params = {}) => vm.$u.post(BASE_API+'imChatGroup/updateGroupInfo', params),
		//更新我的群聊设置
		updateMyGroupSet: (params = {}) => vm.$u.post(BASE_API+'imGroupUser/updateMyGroupSet', params),
		//是否被屏蔽
		getChatPingBiFlag: (params = {}) => vm.$u.post(BASE_API+'imGroupUser/getChatPingBiFlag', params),
		//清空我的聊天记录
		clearChatMessage: (params = {}) => vm.$u.post(BASE_API+'imGroupUser/clearChatMessage', params),
		//解算群组
		delChatGroup: (params = {}) => vm.$u.post(BASE_API+'imGroupUser/delChatGroup', params),
		//退出群组
		quitChatGroup: (params = {}) => vm.$u.post(BASE_API+'imGroupUser/quitChatGroup', params),
		//删除群成员
		deleteMemberForGroup: (params = {}) => vm.$u.post(BASE_API+'imGroupUser/deleteMemberForGroup', params),
		//删除群成员
		addMemberForGroup: (params = {}) => vm.$u.post(BASE_API+'imGroupUser/addMemberForGroup', params),
		//发红包(单聊)
		sendRedBag: (params = {}) => vm.$u.post(BASE_API+'imGroupUser/sendRedBag', params),
		//发红包(单聊)
		sendTransfer: (params = {}) => vm.$u.post(BASE_API+'imGroupUser/sendTransfer', params),
		//发红包(群聊)
		sendRedBagForGroup: (params = {}) => vm.$u.post(BASE_API+'imGroupUser/sendRedBagForGroup', params),
		//领红包
		receviceRedBag:(params = {}) => vm.$u.post(BASE_API+'imGroupUser/receviceRedBag', params),
		//领取转账
		receiveTransfer:(params = {}) => vm.$u.post(BASE_API+'imGroupUser/receiveTransfer', params),
		//查询红包是否已经领取
		getTransferReceiveRecords:(params = {}) => vm.$u.post(BASE_API+'imGroupUser/getTransferReceiveRecords', params),
		//抢群聊的红包
		receviceRedBagForGroup:(params = {}) => vm.$u.post(BASE_API+'imGroupUser/receviceRedBagForGroup', params),
		//获取红包领取记录
		getRedBagReceiveList:(params = {}) => vm.$u.post(BASE_API+'imGroupUser/getRedBagReceiveList', params),
		revertMsg:(params = {}) => vm.$u.post(BASE_API+'imMessageGroup/revertMsg', params),
		//获取音视频通话的用户信息
		getChatGroupTrcMembers: (params = {}) => vm.$u.post(BASE_API+'imGroupUser/getChatGroupTrcMembers', params),		
	}
	
	const groupMessage={
		//获取群聊信息记录
		getMessageListByChatGroupId: (params = {}) => vm.$u.post(BASE_API+'imMessageGroup/getMessageListByChatGroupId', params),
		//修改聊天记录
		updateServerMessageRecord:(params = {}) => vm.$u.post(BASE_API+'imMessageGroup/updateServerMessageRecord', params),
	}
	const friendCircle={
		releaseFriendCircle: (params = {}) => vm.$u.post(BASE_API+'imFriendCircle/releaseNewCircle', params),
		getCircleDataList: (params = {}) => vm.$u.post(BASE_API+'imFriendCircle/getCircleDataList', params),
		deleteCircle: (params = {}) => vm.$u.post(BASE_API+'imFriendCircle/deleteCircle', params),
		clickThumb: (params = {}) => vm.$u.post(BASE_API+'imFriendCircle/clickThumb', params),
		handleComment:(params = {}) => vm.$u.post(BASE_API+'imFriendCircleComment/handleComment', params),
		checkFriendCircleUpdate:(params = {}) => vm.$u.post(BASE_API+'imFriendCircle/checkFriendCircleUpdate', params),
	}
	//AI
	const chatgpt={
		chatGpt:(params = {}) => vm.$u.post(BASE_API+"/chatGpt/chat",params),
		clearChatGpt:(params = {}) => vm.$u.get(BASE_API+"/chatGpt/clearChatGpt",params),
		startWSChatWithSSE:(params = {}) => vm.$u.get(BASE_API+"/chatGpt/startWSChatWithSSE",params),
		reloadExampleList:(params = {}) => vm.$u.post(BASE_API+"/chatGpt/quesTemplateList",params),
		chatToImage:(params = {}) => vm.$u.post(BASE_API+"/chatGpt/chatToImage",params),
	}
	//music
	const music={
		searchMusicList:(params = {}) => vm.$u.post(BASE_API+"/freeMusic/searchMusicList",params),
		getSongInfoAndLrc:(params = {}) => vm.$u.post(BASE_API+"/freeMusic/getSongInfoAndLrc",params),
		getSongSrc:(params = {}) => vm.$u.post(BASE_API+"/freeMusic/getSongSrc",params),
		downLoadSong:(params = {}) => vm.$u.post(BASE_API+"/freeMusic/downLoadSong",params),
	}

	const multipartAddress={
		//上传文件 fileSaveTarget:local表示本地  oss表示云
		'updload':multipartUrl+'file/upload?target='+fileSaveTarget,		
		"target":fileSaveTarget,//local表示本地 oss表示云，
		'getFileByPath':multipartUrl+'file/getFileFromParam?filePath=',//根据路径查看下载附件
		'showFile':multipartUrl+"images/"
	}
	vm.$u.api = {sys,multipartAddress,imUser,chatGroup,chatgpt,friendCircle,music,groupMessage};
}



export default {
	install
}
